package com.xs.ahoi.hcxs.ui.dialog;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.View;
import butterknife.ButterKnife;
import com.xs.ahoi.hcxs.R;
import com.xujiaji.happybubble.BubbleDialog;
import com.xujiaji.happybubble.BubbleLayout;

/**
 * 气泡对话框
 */
public class BaseBubbleDialog extends BubbleDialog {

    public View getLayout() {
        return null;
    }

    public BaseBubbleDialog(Context context) {
        super(context);
        setTransParentBackground();
        setPosition(Position.BOTTOM);

        View view = getLayout();
        addContentView(view);
        ButterKnife.bind(this, view);

        // 设置页面布局
        BubbleLayout layout = new BubbleLayout(context);
        layout.setBubbleColor(ContextCompat.getColor(getContext(), R.color.colorBlack));
        // 箭头长度
        layout.setLookLength(30);
        // 箭头宽度
        layout.setLookWidth(30);
        setBubbleLayout(layout);
    }

    // 弹出框靠近点击的view位置
    public void nearToClickItem() {
        setRelativeOffset(-8);
    }
}